<!DOCTYPE html>
<html style="height: 100%;">
<head>
	<title>考勤</title>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1.0, user-scalable=no"/>
	<script src="js/flexible.js"></script>
	<!-- 引入样式 -->
	<link rel="stylesheet" href="https://unpkg.com/mint-ui/lib/style.css">
	<link rel="stylesheet" type="text/css" href="css/style.css"/>
</head>
<body style="height: 100%;">
<div class="contBg" id="attendance">
	<ul	v-infinite-scroll="loadMore"
		   infinite-scroll-disabled="scrollLoading"
		   infinite-scroll-distance="1">
		<li v-for="item in list">
			<h6>
				<span v-text="item.date"></span>
			</h6>
			<div class="cont">
				<table cellspacing="0" cellpadding="0">
					<thead>
					<tr>
						<th style="text-align: left;">工人</th>
						<th>正常打卡</th>
						<th>异常打卡</th>
						<th>未打卡</th>
					</tr>
					</thead>
					<tbody v-if="1==1">
					<tr v-for="tab in item.migAttendDataBoList">
						<td style="text-align: left;" v-text="tab.realname"></td>
						<td v-text="tab.normal"></td>
						<td v-text="tab.error"></td>
						<td v-text="tab.notClick"></td>
					</tr>
					</tbody>

					<tbody v-else>
					<tr>
						<td style="text-align: left;" v-text="item.realname"></td>
						<td v-text="item.normal"></td>
						<td v-text="item.error"></td>
						<td v-text="item.notClick"></td>
					</tr>
					</tbody>
				</table>

			</div>
		</li>
	</ul>
	<br>
	<div class="loding" v-cloak>
		<mt-spinner style="margin: 0px auto;display: block;width: 30px;" v-show="loading" color="#666" :size="20"></mt-spinner>
		<p v-show="last" style="text-align: center; color:#666;line-height: 29px;">没有数据了</p>
	</div>
</div>
<script src="js/vue.min.js"></script>
<script src="js/all.js" type="text/javascript" charset="utf-8"></script>
<script src="https://unpkg.com/mint-ui/lib/index.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="js/message.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
    var vm = new Vue({
        el:"#attendance",
        data:{
            //上拉加载
            loading:false,
            scrollLoading:false,
//				  last:false,//是否显示已到最底部
            last:true,//是否显示已到最底部
            page:1,//传给后端的页数
            list:[],

            getStatus:"",
            isManager:0
        },
        methods:{
            query:function(){
//						this.scrollLoading = true;  //true滚动事件停止触发
                this.scrollLoading = false;
                this.loading = true;				//true加载效果圈显示
                if (true) {
                    this.getStatus = "getAttenDayCountList"
                    this.getData(1)   //班组长考勤消息

                }else{
                    this.getStatus = "getWorkerAtter"
                    this.getData(0)		//工人考勤消息
                }
            },
            getData:function(){
                axios.get(url+"/"+this.getStatus,{
                    params:{

                        "groupId": GetQueryString("groupId"),
                        "projectId": GetQueryString("projectId"),
                      /*  "groupId": GetQueryString("groupId")||"10639",
                        "projectId": GetQueryString("projectId")||"0",*/
                        "attendDate": this.time
                    },
                    headers:{"token":GetQueryString("token")}
                    //headers:{"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpdyI6IlR1ZSBBdWcgMTUgMTc6MTQ6MzAgQ1NUIDIwMTcifQ.S6k4iRxnqEKtoWT4DiSYEVchOAFy1VaivQM2nXoaORsuserId:679"}
                }).then(function(data){
//                            console.log(data.data.data);

                    var dataList = data.data.data;

                    alert(dataList.length);
                    if (dataList) {
//						    	alert(dataList);
//                                console.log(dataList[0]);
                        this.page++;
                        for (var i=0;i<dataList.length;i++) {
//                                    console.log(dataList[i].date);
//									dataList[i].date = replaceDate('m-d',dataList[i].attdate);

//                                    console.log(dataList[0].attdate);
//                                    dataList[0].date = replaceDate('m-d',dataList[0].attdate);
                            dataList[0].attdate = replaceDate('m-d',dataList[0].attdate);
                        }
                        this.list.push.apply(this.list,data.data.data);
                        this.scrollLoading = false;
                        this.loading = false;
                        if(dataList.length==0){
                            this.scrollLoading = true;
                            this.last = true;
                        }
                    }else{
                        this.loading = false;
                        this.scrollLoading = true;
                        this.last = true;
                    }

                }.bind(this))
            },
            loadMore: function() {
                this.query(true);
            }
        },
        mounted:function(){
            this.$nextTick(function(){// 文档加载后调用
                this.isManager = GetQueryString("isManager")
                this.query()
            });
        }
    })

</script>
</body>
</html>
